#coding=utf-8

require "aio/core"

class Aio::Module::Cmd::Cisco::ShowClock < Aio::Module::Cmd::Cisco
  include Aio::Module

  def initialize
    super({
      :cmd_full     => "show clock",
      :cmd_short    => "sh clo",
      :author       => "Elin",
      :description  => "This is Cisco Command# show clock",
      :ranking      => Ranking_1,
      :platform     => "all",
    })
	end

	def parse
		context = self.context.dup
		clock = {}
		useful[:clock] = clock
		context.readline_match_block(/(?<time>.*)\.\d+ (?<zone>[^\s]+) (?<week>[^\s]+) (?<month>[^\s]+) (?<day>[^\s]+) (?<year>[^\s]+)/) do |block|
			block.update(clock, :time)
			block.update(clock, :zone)
			block.update(clock, :week)
			block.update(clock, :year)
			block.update(clock, :month, Aio::Base::Toolkit::Date.month_to_i(block[:month]))
			block.update(clock, :day)
		end
	end
end
